home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / ieee754 / nan.h < prev    next >
C/C++ Source or Header  |  1992-11-18  |  1KB  |  47 lines

  1. /* `NAN' constant for IEEE 754 machines.
  2.  
  3. Copyright (C) 1992 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5.  
  6. The GNU C Library is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU Library General Public License as
  8. published by the Free Software Foundation; either version 2 of the
  9. License, or (at your option) any later version.
  10.  
  11. The GNU C Library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. Library General Public License for more details.
  15.  
  16. You should have received a copy of the GNU Library General Public
  17. License along with the GNU C Library; see the file COPYING.LIB.  If
  18. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  19. Cambridge, MA 02139, USA.  */
  20.  
  21. #ifndef    _NAN_H
  22.  
  23. #define    _NAN_H    1
  24.  
  25. /* IEEE Not A Number.  */
  26.  
  27. #include <endian.h>
  28.  
  29. #if __BYTE_ORDER == __BIG_ENDIAN
  30. #define    __nan_bytes        { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
  31. #endif
  32. #if __BYTE_ORDER == __LITTLE_ENDIAN
  33. #define    __nan_bytes        { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
  34. #endif
  35.  
  36. #ifdef    __GNUC__
  37. #define    NAN \
  38.   (__extension__ ((union { unsigned char __c[8];                  \
  39.                double __d; })                      \
  40.           { __nan_bytes }).__d)
  41. #else    /* Not GCC.  */
  42. static CONST char __nan[8] = __nan_bytes;
  43. #define    NAN    (*(CONST double *) __nan)
  44. #endif    /* GCC.  */
  45.  
  46. #endif    /* nan.h */
  47.